<?php

$userid         = get_loggedin_userid();
$current_lat    = get_input('current_lat');
$current_lng    = get_input('current_long');
$offset         = get_input('offset');
$limit          = get_input('limit');
$distance       = 30;

$interests = get_nearby_interests($userid, $current_lat, $current_lng, $distance, $limit, $offset);
$i = 0;
$return = array();
foreach($interests as $interest) {
    $return[$i]['interest'] = to_interest_array($interest);
    $return[$i]['distance'] = display_distance($interest->distance);
    $i++;
}

$gowalla_ids    = json_decode(get_input('gowalla_ids'));
$distance       = 30;
$unrated        = remove_rated_gowalla_places($userid, $current_lat, $current_lng, $distance, $gowalla_ids);

echo json_encode(export_result(200, array('unrated' => $unrated, 'interests' => $return)));

?>